import request from "@/utils/request";

// 获取菜单 /admin/acl/permission
export const apiGetMenu = ()=>request('/admin/acl/permission')

// 根据角色获取菜单 /admin/acl/permission/toAssign/{roleId}
export const apiGetMenuByRole = roleId=>request(`/admin/acl/permission/toAssign/${roleId}`)

// 给角色授权  /admin/acl/permission/doAssign  permissionId 需要字符串
export const apiApplyPower = (roleId,permissionId)=>{
  return request({
    url:'/admin/acl/permission/doAssign',
    method: "post",
    params: {roleId, permissionId}
  })
}

// 通过id删除权限
export const apiDeletePower = (id)=>request.delete(`/admin/acl/permission/remove/${id}`)

// 添加权限
export const apiAddPower = data=>request.post('/admin/acl/permission/save',data)

// 修改权限
export const apiUpdatePower = data=>request.put('/admin/acl/permission/update',data)



